package com.vend.good.view

import android.content.Intent
import android.os.Bundle
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.vend.common.base.BaseActivity
import com.vend.common.constant.CustomConstant
import com.vend.common.constant.RouterConstant
import com.vend.common.mvp.IPresenter
import com.vend.good.R
import kotlinx.android.synthetic.main.activity_good_list.*

/**
 * Created by glendal on 2022/01/26.
 * 货物列表调试的展示界面
 */
@Route(path = RouterConstant.GOOD_DETAIL_ACTIVITY_TEST)
class GoodListActivity : BaseActivity<IPresenter>() {
    override fun getContentLayoutId(): Int {
        return R.layout.activity_good_list
    }

    override fun initView(savedInstanceState: Bundle?) {
        tv_good_detail.setOnClickListener {
//            ARouter.getInstance().build(RouterConstant.GOOD_DETAIL_ACTIVITY).navigation()
            startActivity(Intent(this,GoodDetailActivity::class.java))
        }
        addFragment()
    }
    private fun addFragment(){
        //这里是将网页加载数据出来方便调试逻辑处理
        val fragment = GoodListFragment()
        val bundle = Bundle().also {
            it.putBoolean(CustomConstant.IS_VIEW_PAGE,false)
        }
        fragment.arguments = bundle;//数据传递到fragment中
        val begin = supportFragmentManager.beginTransaction()
        begin.replace(R.id.contains,fragment)
        begin.commit()
    }
}